<%-- 自定义实体添加页面 --%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/views/common/taglibs.jsp" %>

<!DOCTYPE>
<html>
<head>
    <!-- 引入通用js、css文件(xiaogq) -->
    <meta name="decorator" content="bootstrap"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/system/custom/entity/entity_add.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/common/operation/sys_operation.css"/>
</head>
<body>
    <!-- 加载列表操作 -->
    <div class="button_list">
        <a href="javascript:;" onclick="saveEditDept();">
            <span class="span_button">
                <span><img src="${ctx}/image/common/operation/oper_SAVE.png"></span>
                <span name="buTitle">保存</span>
            </span>
        </a>
        <a href="javascript:;" onclick="javascript:parent.closeTab();">
            <span class="span_button">
                <span><img src="${ctx}/image/common/operation/oper_CANCEL.png"></span>
                <span name="buTitle">取消</span>
            </span>
        </a>
    </div>

    <div class="content row">
        <h3>基础信息</h3>
        <hr>
        <form role="form" class="entityForm" id="entity_form" method="post" action="${ctx}/Dept/saveEditDept.do" enctype="multipart/form-data">
            <input type="hidden" id="deptId" name="id" value="${dept.id}"/>
            <div class="row">
                <div class="col-lg-5 col-md-5">
                    <div class="form-group">
                        <label for="name_varchar" class="col-lg-3 col-md-3 control-label">部门名称:<span style="color: red">*</span></label>
                        <div class="col-lg-9 col-md-9">
                            <input type="text" class="form-control" id="name_varchar" name="name" value="${dept.name}"/>
                        </div>
                    </div>
                </div>
                <div class="col-lg-5 col-md-5">
                    <div class="form-group" style="overflow: visible;">
                        <label class="col-lg-3 col-md-3 control-label">部门主管:</label>
                        <div class="col-lg-9 col-md-9">
                            <input type='hidden' id='managerIdList' name='managerIdList' value="${managEmpIds}"/>
                            <div class='fl form-text' style='height: auto;' id='deptCharge'>
                                <input id="deptSupervise" type="text" class="form-control deptSupervise" />
                            </div>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-5 col-md-5">
                    <div class="form-group">
                        <label for="plait_people_decimal" class="col-lg-3 col-md-3 control-label">编制人数:</label>
                        <div class="col-lg-9 col-md-9">
                            <input type="number" class="form-control" id="plait_people_decimal" name="plaitPeople" value="${dept.plaitPeople}">
                        </div>
                    </div>
                </div>
                <div class="col-lg-5 col-md-5">
                    <div class="form-group">
                        <label for="dept_description_textarea" class="col-lg-3 col-md-3 control-label">描述:</label>
                        <div class="col-lg-9 col-md-9">
                            <textarea class="form-control" rows="2" id="dept_description_textarea" name="description">${dept.description}</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="${ctx}/js/system/organization/dept/dept.js"></script>
    <script type="text/javascript">
        new selectMax({
            el:$("#deptCharge"),
            input:$(".deptSupervise"),
            inputId:"deptSupervise",
            dataList:${empAllList},
            selectList:${empSelList},
            methods:function(e,select){
                //点击选中回调函数  参数一 DOM对象   参数二 选择选中数据
                var arr = select.map(function (x) {
                    return x.id;
                });
                $("#managerIdList").val(arr);
            },
            deletemethods:function (e,select) {
                //点击删除回调函数   参数一 DOM对象   参数二 选择选中数据
                var arr = select.map(function (x) {
                    return x.id;
                });
                $("#managerIdList").val(arr);
            }
        });
    </script>
</body>
</html>
